/****************************************************************************
 *
 *  ALi (Shanghai) Corporation, All Rights Reserved. 2002 Copyright (C)
 *
 *  File: UpgradeCommand.h
 *
 *  Description: define variables and functions interface about upgrade commands
 *		         
 *  History:
 *      Date		Author      Version		Comment
 *      ====        ======      =======		=======
 *  1   2007.8.10	Tony Wang	1.0			Create
 ****************************************************************************/


#ifndef __UPGRADECOMMAND_H__
#define __UPGRADECOMMAND_H__

#include "CommDefine.h"

#ifdef __cplusplus
extern "C"
{
#endif
/********************************* Macro and Struct Define *********************************/
	//define


/********************************* Function Define *********************************/

/****************************************************************************
 *
 *  Name:		clear_packet_index
 *	Function:	clear global packet index
 *	variable:	
 *  
 ****************************************************************************/
 
void clear_packet_index();
/****************************************************************************
 *
 *  Name:		cmd_version
 *	Function:	command version return chunk info
 *	variable:	version 	-- get protocol version about STB
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_version_new(UINT32 *version);

/****************************************************************************
 *
 *  Name:		cmd_chunk
 *	Function:	command chunk return chunk info
 *	variable:	chunk_info 		-- chunk info about command version return
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_chunk_new();	

/****************************************************************************
 *
 *  Name:		cmd_address
 *	Function:	set start address
 *	variable:	addr -- start address
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_address_new(UINT32 addr);

/****************************************************************************
 *
 *  Name:		cmd_move
 *	Function:	move chunk
 *	variable:	index -- chunk index
 *				offset - chunk offset
 *				
 *  
 ****************************************************************************/
UINT32 cmd_move_new(UINT32 index,UINT32 offset);	

/****************************************************************************
 *
 *  Name:		cmd_transfer
 *	Function:	move chunk
 *	variable:	buffer - data buffer for transfer
 *				nBufLen	-- buffer len
 *				pfProgress 		-- callback function about progress
 *				pfUserAbort 	-- callback function about if user abort thread
 *  
 ****************************************************************************/
UINT32 cmd_transfer_new(unsigned char *buffer, int nBufLen, 
		CALLBACK_PROGRESS pfProgress,  CALLBACK_USERABORT pfUserAbort);

/****************************************************************************
 *
 *  Name:		cmd_burn
 *	Function:	burn flash
 *	variable:	pfProgress 		-- callback function about progress
 *				
 *								
 *  
 ****************************************************************************/
UINT32 cmd_burn_new(int nBurnSize, CALLBACK_PROGRESS pfProgress, BOOL bCareReturn);

/****************************************************************************
 *
 *  Name:		cmd_burn_new_ext
 *	Function:	burn flash, with user abort
 *	variable:	pfProgress 		-- callback function about progress
 *				
 *								
 *  
 ****************************************************************************/
UINT32 cmd_burn_new_ext(int nBurnSize, CALLBACK_PROGRESS pfProgress, BOOL bCareReturn,  CALLBACK_USERABORT pfUserAbort);



/****************************************************************************
 *
 *  Name:		cmd_reboot
 *	Function:	reboot target
 *	variable:	
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_reboot_new();

#ifdef __cplusplus
}
#endif		/*	__cplusplus		*/

#endif	/* __UPGRADECOMMAND_H__ */
